import { createBrowserRouter } from "react-router-dom";
import MainLayout from "../layouts/MainLayout";
import ManageLayout from "../layouts/ManageLayout";
import QuestionLayout from "../layouts/QuestionLayout";
import Home from "../pages/Home";
import NotFound from "../pages/NotFound";
import Edit from "../pages/question/Edit";
import Stat from "../pages/question/Stat";
import List from "../pages/manage/List";
import Login from "../pages/login/Login";
import Register from "../pages/register/Register";
import Test from "../components/Todo/Test";
import Form from "../pages/component/Form";
import Officer from "../pages/manage/Officer";
// import ProtectedRoute from '../components/ProtectedRoute';
import UserManagement from "../components/Grid/UserManagement";
import File from "../components/File/File";
const router = createBrowserRouter([
  {
    path: "/",
    element: <MainLayout />,
    children: [
      {
        path: "/",
        element: <Home />,
      },
      {
        path: "/login",
        element: <Login />,
      },
      {
        path: "/register",
        element: <Register />,
      },
      {
        path: "/test",
        element:<Test />,
      },
      {
        path: "/form",
        element:<Form />,
      },
      {
        path: "manage",
        element: <ManageLayout />,
        children: [
          {
            path: "soldierlist",
            element: <List />,
          },
          {
            path: "officerlist",
            element:<Officer />,
          },
          {
            path: "civilianlist",
            element: <UserManagement />,
          },
        ],
      },
      {
        path: "/file",
        element: <File />,
      },
      { path: "*", element: <NotFound /> },
    ],
  },
  {
    path: "/question",
    element: <QuestionLayout />,
    children: [
      { path: "edit/:id", element: <Edit /> },
      { path: "stat/:id", element: <Stat /> },
    ],
  },
]);

export default router;
